<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"emoh.xyz","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="123456789&#x2F;* 11g的flashbackup 分好几种，分别用途不一样。 A.flashback database 闪回数据库，简单理解就是把数据库闪回到某个以前的时间点， 能恢复到的最早的SCN， 取决与Flashback Log中记录的最早SCN B.flashback drop 回收数据库表，用于表误drop后恢复。类似Windows的回收站。 C.flashback query">
<meta property="og:type" content="article">
<meta property="og:title" content="oracle闪回特性">
<meta property="og:url" content="http://emoh.xyz/2020/05/28/2020-05-28-oracle%E9%97%AA%E5%9B%9E%E7%89%B9%E6%80%A7/index.html">
<meta property="og:site_name" content="Just do it!">
<meta property="og:description" content="123456789&#x2F;* 11g的flashbackup 分好几种，分别用途不一样。 A.flashback database 闪回数据库，简单理解就是把数据库闪回到某个以前的时间点， 能恢复到的最早的SCN， 取决与Flashback Log中记录的最早SCN B.flashback drop 回收数据库表，用于表误drop后恢复。类似Windows的回收站。 C.flashback query">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2020-05-28T09:24:18.000Z">
<meta property="article:modified_time" content="2020-05-28T09:28:49.105Z">
<meta property="article:author" content="Emoh">
<meta property="article:tag" content="闪回">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="http://emoh.xyz/2020/05/28/2020-05-28-oracle%E9%97%AA%E5%9B%9E%E7%89%B9%E6%80%A7/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>oracle闪回特性 | Just do it!</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">Just do it!</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://emoh.xyz/2020/05/28/2020-05-28-oracle%E9%97%AA%E5%9B%9E%E7%89%B9%E6%80%A7/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/touxiang.png">
      <meta itemprop="name" content="Emoh">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Just do it!">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          oracle闪回特性
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              

              <time title="创建时间：2020-05-28 17:24:18 / 修改时间：17:28:49" itemprop="dateCreated datePublished" datetime="2020-05-28T17:24:18+08:00">2020-05-28</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/oracle-%E5%A4%87%E4%BB%BD%E6%81%A2%E5%A4%8D/" itemprop="url" rel="index"><span itemprop="name">oracle 备份恢复</span></a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/* </span></span><br><span class="line"><span class="comment">11g的flashbackup 分好几种，分别用途不一样。 </span></span><br><span class="line"><span class="comment">A.flashback database 闪回数据库，简单理解就是把数据库闪回到某个以前的时间点， </span></span><br><span class="line"><span class="comment">能恢复到的最早的SCN， 取决与Flashback Log中记录的最早SCN </span></span><br><span class="line"><span class="comment">B.flashback drop 回收数据库表，用于表误drop后恢复。类似Windows的回收站。 </span></span><br><span class="line"><span class="comment">C.flashback query 闪回表记录，用于数据表记录的恢复 </span></span><br><span class="line"><span class="comment">D.falshabck Table 闪回数据库表， </span></span><br><span class="line"><span class="comment">后两个是重点，下面说明。 </span></span><br><span class="line"><span class="comment">*/</span></span><br></pre></td></tr></table></figure>

<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">-- A.flashback database相关</span></span><br><span class="line"> </span><br><span class="line"><span class="comment">/* </span></span><br><span class="line"><span class="comment">1.默认情况数据库的flashback database是关闭，可以在mount exclusive状态下打开。 </span></span><br><span class="line"><span class="comment">在设置了闪回恢复区后，可以启动闪回数据库功能。 </span></span><br><span class="line"><span class="comment">*/</span> </span><br><span class="line"><span class="comment">--1.检查是否启动了flash recovery area </span></span><br><span class="line"><span class="keyword">show</span> parameter db_recovery_file </span><br><span class="line"><span class="comment">--2.检查是否启用了归档 </span></span><br><span class="line"><span class="keyword">archive</span> <span class="keyword">log</span> <span class="keyword">list</span>; </span><br><span class="line"><span class="comment">--3.flashback database 默认是关闭的，查看方法 </span></span><br><span class="line"><span class="keyword">select</span> flashback_on <span class="keyword">from</span> v$<span class="keyword">database</span>; </span><br><span class="line"><span class="comment">--4.查询当前的scn </span></span><br><span class="line"><span class="keyword">SELECT</span> CURRENT_SCN <span class="keyword">FROM</span> V$<span class="keyword">DATABASE</span>; </span><br><span class="line"><span class="comment">--5.查询当前的时间 </span></span><br><span class="line"><span class="keyword">select</span> to_char(<span class="keyword">sysdate</span>,<span class="string">'yy-mm-dd hh24:mi:ss'</span>) <span class="built_in">time</span> <span class="keyword">from</span> dual; </span><br><span class="line"><span class="comment">--6.查看SCN 和 timestamp 之间的对应关系： </span></span><br><span class="line"><span class="keyword">select</span> <span class="keyword">scn</span>,to_char(time_dp,<span class="string">'yyyy-mm-dd hh24:mi:ss'</span>)<span class="keyword">from</span> sys.smon_scn_time; </span><br><span class="line"><span class="comment">--7.恢复到时间点，或者恢复到SCN </span></span><br><span class="line">flashback database to timestamp to_timestamp('09-10-14 14:37:05′,'yy-mm-dd hh24:mi:ss'); </span><br><span class="line">flashback database to scn 947921;</span><br></pre></td></tr></table></figure>
<a id="more"></a>

<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">-- B. flashback table 恢复误drop表 </span></span><br><span class="line"><span class="keyword">drop</span> <span class="keyword">table</span> sphsy.login_table; </span><br><span class="line"><span class="keyword">select</span> * <span class="keyword">from</span> flash_table; </span><br><span class="line"><span class="comment">--purge table sphsy.login_table;清空回收站 </span></span><br><span class="line">flashback table sphsy.login_table to before <span class="keyword">drop</span>; </span><br><span class="line"><span class="keyword">select</span> * <span class="keyword">from</span> sphsy.login_table;</span><br></pre></td></tr></table></figure>

<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">-- C. flashback query 实现行级恢复 </span></span><br><span class="line"><span class="comment">/* </span></span><br><span class="line"><span class="comment">flashback查询用于获取先前时间点的表行级数据。当使用flashback查询时， </span></span><br><span class="line"><span class="comment">需要在表名后指定as of timestamp子句或as of SCN子句，其中as of timestamp用于指定早期时间点， </span></span><br><span class="line"><span class="comment">而as of SCN用于指定早期的SCN值，示例如下： </span></span><br><span class="line"><span class="comment">*/</span> </span><br><span class="line"><span class="comment">-- 1.查原始记录 ，区间内有62 行 </span></span><br><span class="line"><span class="keyword">select</span> * </span><br><span class="line"><span class="keyword">from</span> sphsy.login_table a </span><br><span class="line"><span class="keyword">where</span> a.id &gt; <span class="number">201204171078</span> </span><br><span class="line"><span class="keyword">and</span> a.id &lt; <span class="number">201204171141</span> </span><br><span class="line"><span class="keyword">order</span> <span class="keyword">by</span> a.id ; </span><br><span class="line"><span class="comment">-- 2.晚于区间的有 3016 </span></span><br><span class="line"><span class="keyword">select</span> program,<span class="keyword">count</span>(*) </span><br><span class="line"><span class="keyword">from</span> sphsy.login_table a </span><br><span class="line"><span class="keyword">where</span> a.id &gt;= <span class="number">201204171141</span> </span><br><span class="line"><span class="keyword">group</span> <span class="keyword">by</span> program ; </span><br><span class="line"><span class="comment">-- 3. 删除 </span></span><br><span class="line"><span class="keyword">delete</span> <span class="keyword">from</span> sphsy.login_table a </span><br><span class="line"><span class="keyword">where</span> a.id &gt; <span class="number">201204171078</span> </span><br><span class="line"><span class="keyword">and</span> a.id &lt; <span class="number">201204171141</span> </span><br><span class="line"><span class="comment">-- 4.利用闪回特性查到区间内，有62行 </span></span><br><span class="line"><span class="keyword">select</span> * <span class="keyword">from</span> sphsy.login_table </span><br><span class="line"><span class="keyword">as</span> <span class="keyword">of</span> <span class="built_in">timestamp</span> to_timestamp(<span class="string">'2012-04-17 17:20:30′,'</span>YYYY-MM-DD HH24:MI:SS<span class="string">') </span></span><br><span class="line"><span class="string">where id &gt; 201204171078 </span></span><br><span class="line"><span class="string">and id &lt; 201204171141 </span></span><br><span class="line"><span class="string">-- 5.不利用闪回特性，直接查询发现没有 </span></span><br><span class="line"><span class="string">select * from sphsy.login_table </span></span><br><span class="line"><span class="string">where id &gt; 201204171078 </span></span><br><span class="line"><span class="string">and id &lt; 201204171141 </span></span><br><span class="line"><span class="string">-- 6.进行数据恢复 </span></span><br><span class="line"><span class="string">- 禁止表上的触发器 </span></span><br><span class="line"><span class="string">alter trigger sphsy.T_INS_LOGIN_TABLE disable ; </span></span><br><span class="line"><span class="string">- 恢复数据 </span></span><br><span class="line"><span class="string">insert into sphsy.login_table </span></span><br><span class="line"><span class="string">select * from sphsy.login_table </span></span><br><span class="line"><span class="string">as of timestamp to_timestamp('</span><span class="number">2012</span><span class="number">-04</span><span class="number">-17</span> <span class="number">17</span>:<span class="number">20</span>:<span class="number">30</span>′,<span class="string">'YYYY-MM-DD HH24:MI:SS'</span>) </span><br><span class="line"><span class="keyword">where</span> <span class="keyword">id</span> &gt; <span class="number">201204171078</span> </span><br><span class="line"><span class="keyword">and</span> <span class="keyword">id</span> &lt; <span class="number">201204171141</span> </span><br><span class="line">- 恢复触发器 </span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">trigger</span> sphsy.T_INS_LOGIN_TABLE <span class="keyword">enable</span> ; </span><br><span class="line"><span class="comment">-- 7.晚于区间的数据回来了3130 = 3016 +62 + 后来的数据。实现了区间恢复误删除。 </span></span><br><span class="line"><span class="keyword">select</span> program,<span class="keyword">count</span>(*) </span><br><span class="line"><span class="keyword">from</span> sphsy.login_table a </span><br><span class="line"><span class="keyword">where</span> a.id &gt;= <span class="number">201204171078</span> </span><br><span class="line"><span class="keyword">group</span> <span class="keyword">by</span> program ;</span><br></pre></td></tr></table></figure>

<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br></pre></td><td class="code"><pre><span class="line">- D. flashback table 恢复表到先前状态 </span><br><span class="line"><span class="comment">/* </span></span><br><span class="line"><span class="comment">flashback查询可以用于恢复被误删除的表行数据，但是用户在表上执行了其他的DML语句误操作（insert或update），则不能直接使用flashback查询将表数据恢复到先前时间点，从oracle10g开始，使用flashback table语句可以将表恢复到先前时间点，通过使用该特征，可以避免执行基于时间点的不完全恢复，注意如果要在某个表上使用flashback table特征，则要求必须具有以下条件： </span></span><br><span class="line"><span class="comment">a.用户必须具有flashback any table系统权限或flashback对象权限 </span></span><br><span class="line"><span class="comment">b.用户必修在表上具有select insert delete和alter权限 </span></span><br><span class="line"><span class="comment">c.必须合理设置初始化参数undo_retention，以确保UNDO信息保留足够时间 </span></span><br><span class="line"><span class="comment">d.必须激活行移动特征：alter table table_name enable row movement； </span></span><br><span class="line"><span class="comment">*/</span> </span><br><span class="line"><span class="comment">-- 1.查原始记录 ，区间内有62 行 </span></span><br><span class="line"><span class="keyword">select</span> * </span><br><span class="line"><span class="keyword">from</span> sphsy.login_table a </span><br><span class="line"><span class="keyword">where</span> a.id &gt; <span class="number">201204171078</span> </span><br><span class="line"><span class="keyword">and</span> a.id &lt; <span class="number">201204171141</span> </span><br><span class="line"><span class="keyword">order</span> <span class="keyword">by</span> a.id ; </span><br><span class="line"><span class="comment">-- 2.晚于区间的有 3074 </span></span><br><span class="line"><span class="keyword">select</span> <span class="keyword">count</span>(*) </span><br><span class="line"><span class="keyword">from</span> sphsy.login_table a </span><br><span class="line"><span class="keyword">where</span> a.id &gt;= <span class="number">201204171141</span>; </span><br><span class="line"><span class="comment">--3. 删除 ,先记下时间点，2012-04-17 17:43:46 </span></span><br><span class="line"><span class="keyword">select</span> to_char(<span class="keyword">sysdate</span>,<span class="string">'YYYY-MM-DD HH24:MI:SS'</span>) <span class="keyword">from</span> dual ; </span><br><span class="line"><span class="keyword">delete</span> <span class="keyword">from</span> sphsy.login_table a </span><br><span class="line"><span class="keyword">where</span> a.id &gt; <span class="number">201204171078</span> </span><br><span class="line"><span class="keyword">and</span> a.id &lt; <span class="number">201204171141</span> </span><br><span class="line"><span class="comment">-- 4.删除之后表 sphysy.login_table继续有修改 ,行3082 </span></span><br><span class="line"><span class="keyword">select</span> <span class="keyword">count</span>(*) </span><br><span class="line"><span class="keyword">from</span> sphsy.login_table a </span><br><span class="line"><span class="keyword">where</span> a.id &gt;= <span class="number">201204171141</span>; </span><br><span class="line"><span class="comment">-- 5.激活行移动特征 </span></span><br><span class="line"><span class="keyword">alter</span> <span class="keyword">table</span> sphsy.login_table <span class="keyword">enable</span> <span class="keyword">row</span> <span class="keyword">movement</span> </span><br><span class="line"><span class="comment">-- 6.利用闪回特性，直接恢复到删除时间点前 </span></span><br><span class="line"><span class="keyword">flashback</span> <span class="keyword">table</span> sphsy.login_table <span class="keyword">to</span> <span class="built_in">timestamp</span> to_timestamp(<span class="string">'2012-04-17 17:43:46′,'</span>YYYY-MM-DD HH24:MI:SS<span class="string">'); </span></span><br><span class="line"><span class="string">-- 7.晚于区间的数据 回到了3080 ，说明时间点之后的修改丢失。 </span></span><br><span class="line"><span class="string">select count(*) </span></span><br><span class="line"><span class="string">from sphsy.login_table a </span></span><br><span class="line"><span class="string">where a.id &gt;= 201204171141 </span></span><br><span class="line"><span class="string">-- 8.往前推1分，恢复到删除之前，删除的62条也回来了。 </span></span><br><span class="line"><span class="string">flashback table sphsy.login_table to timestamp to_timestamp('</span><span class="number">2012</span><span class="number">-04</span><span class="number">-17</span> <span class="number">17</span>:<span class="number">40</span>:<span class="number">46</span>′,<span class="string">'YYYY-MM-DD HH24:MI:SS'</span>); </span><br><span class="line"><span class="comment">-- 62 行 </span></span><br><span class="line"><span class="keyword">select</span> <span class="keyword">count</span>(*) </span><br><span class="line"><span class="keyword">from</span> sphsy.login_table a </span><br><span class="line"><span class="keyword">where</span> a.id &gt; <span class="number">201204171078</span> </span><br><span class="line"><span class="keyword">and</span> a.id &lt; <span class="number">201204171141</span> </span><br><span class="line"><span class="comment">-- 删除之后的数据为3074，代表还有修改丢失。 </span></span><br><span class="line"><span class="keyword">select</span> <span class="keyword">count</span>(*) </span><br><span class="line"><span class="keyword">from</span> sphsy.login_table a </span><br><span class="line"><span class="keyword">where</span> a.id &gt;= <span class="number">201204171141</span> </span><br><span class="line"><span class="comment">/* </span></span><br><span class="line"><span class="comment">总结：方法C，方法D均可以用数据恢复。 </span></span><br><span class="line"><span class="comment">方法C安全，恢复麻烦。方法D简单，有可能数据丢失。 </span></span><br><span class="line"><span class="comment">*/</span></span><br></pre></td></tr></table></figure>
    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/%E9%97%AA%E5%9B%9E/" rel="tag"># 闪回</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2020/05/28/2020-05-28-oracle%E6%95%B0%E6%8D%AE%E5%BA%93hang%E5%A4%84%E7%90%86/" rel="prev" title="oracle数据库hang处理">
      <i class="fa fa-chevron-left"></i> oracle数据库hang处理
    </a></div>
      <div class="post-nav-item">
    <a href="/2020/05/28/2020-05-28-python%E5%AE%89%E8%A3%85/" rel="next" title="python安装">
      python安装 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Emoh"
      src="/images/touxiang.png">
  <p class="site-author-name" itemprop="name">Emoh</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">29</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">16</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">23</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Emoh</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>




  















  

  

</body>
</html>
